package name.matthewgreet.example14.view; import java.util.ArrayList; import java.util.List; import java.util.Locale; import name.matthewgreet.strutscommons.view.SelectBoxItemDisplay2; import name.matthewgreet.strutscommons.view.SingleSelectBoxDisplay2; public class LocaleSelectBoxDisplay extends SingleSelectBoxDisplay2<String,Locale> { @Override protected String getKey(Locale item) { // Unused return null; } @Override protected String getText(Locale item) { // Unused return null; } @Override protected String getValue(String key) { // Unused return null; } protected List<SelectBoxItemDisplay2<String,Locale>> getInitialList() { List<SelectBoxItemDisplay2<String,Locale>> result; result = new ArrayList<>(); result.add(new SelectBoxItemDisplay2<>(Locale.US.getLanguage() + "_" + Locale.US.getCountry(), "American", Locale.US.getLanguage() + "_" + Locale.US.getCountry(), Locale.US)); result.add(new SelectBoxItemDisplay2<>(Locale.UK.getLanguage() + "_" + Locale.UK.getCountry(), "British", Locale.UK.getLanguage() + "_" + Locale.UK.getCountry(), Locale.UK)); result.add(new SelectBoxItemDisplay2<>(Locale.SIMPLIFIED_CHINESE.getLanguage() + "_" + Locale.SIMPLIFIED_CHINESE.getCountry(), "Chinese", Locale.SIMPLIFIED_CHINESE.getLanguage() + "_" + Locale.SIMPLIFIED_CHINESE.getCountry(), Locale.SIMPLIFIED_CHINESE)); result.add(new SelectBoxItemDisplay2<>(Locale.FRANCE.getLanguage() + "_" + Locale.FRANCE.getCountry(), "French", Locale.FRANCE.getLanguage() + "_" + Locale.FRANCE.getCountry(), Locale.FRANCE)); result.add(new SelectBoxItemDisplay2<>(Locale.GERMANY.getLanguage() + "_" + Locale.GERMANY.getCountry(), "German", Locale.GERMANY.getLanguage() + "_" + Locale.GERMANY.getCountry(), Locale.GERMANY)); result.add(new SelectBoxItemDisplay2<>("hi_IN", "Indian", "hi_IN", new Locale("hi","IN"))); result.add(new SelectBoxItemDisplay2<>("ja_JP", "Japanese", "ja_JP", new Locale("ja_JP"))); result.add(new SelectBoxItemDisplay2<>("ko_KR", "Korean", "ko_KR", new Locale("ko_KR"))); result.add(new SelectBoxItemDisplay2<>("ru_RU", "Russian", "ru_RU", new Locale("ru","RU"))); result.add(new SelectBoxItemDisplay2<>("ar_SA", "Saudi Arabian", "ar_SA", new Locale("ar","SA"))); return result; } }